#include <stdio.h>
int a[100] = {0};
int main()
{
	int d = 0, n = 0;
	scanf("%d", &d);
	while ( d != 0 ) 
	{
		a[n] = d;
		n ++;
		scanf("%d", &d);
	}
	for ( int i = n - 1; i >= 0; i-- ) {
		printf("%d ", a[i]);
	}
	return 0;
}


